package cn.wolfcode.wolf2w.controller;


import cn.wolfcode.wolf2w.annotation.UserParam;
import cn.wolfcode.wolf2w.domain.Banner;
import cn.wolfcode.wolf2w.domain.UserInfo;
import cn.wolfcode.wolf2w.query.BannerQueryObject;
import cn.wolfcode.wolf2w.redis.service.IUserinfoRedisService;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/personal")
public class PersonalController {

    @Autowired
    private IUserinfoRedisService userinfoRedisService;

    @GetMapping("/getnum1")
    public Object banners_travel(String ownerId, @UserParam UserInfo userInfo) {
//        System.out.println(ownerId);
//        System.out.println(userInfo);
        String userid = userInfo.getId();

        userinfoRedisService.setUserDayNum(userid, ownerId);
        String id = userinfoRedisService.getUserDayNum(ownerId);
        return JsonResult.success(id);
    }
    @GetMapping("/getnum2")
    public Object banners_travel2(String ownerId, @UserParam UserInfo userInfo) {
        String userid = userInfo.getId();
//        String num = userinfoRedisService.getUserDayNum(userid, ownerId);
        userinfoRedisService.setUserAllNum(userid, ownerId);
        String userAllNum = userinfoRedisService.getUserAllNum(ownerId);
        return JsonResult.success(userAllNum);

    }
}
